package com.dotflat.photoAlbum.repository;

import com.dotflat.photoAlbum.domain.Photo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

public interface PhotoRepository extends JpaRepository<Photo, String>, JpaSpecificationExecutor<Photo> {

    Page<Photo> findAllByDeletedIsFalseAndAlbumId(String albumId, Pageable pageRequest);

    List<Photo> findAllByDeletedIsFalseAndAreaIdAndAlbumIdAndIdIn(String areaId, String albumId, String[] ids);

    Photo getOneByStaffIdAndIdAndDeletedIsFalse(String staffId, String id);

    Photo getOneByAlbumIdAndIdAndDeletedIsFalse(String albumId, String id);

    Photo getOneByAreaIdAndIdAndDeletedIsFalse(String areaId, String id);
}
